package com.zmm.zebulon.module.mp.dal.mysql.message;

import com.zmm.zebulon.common.pojo.PageResult;
import com.zmm.zebulon.module.mp.controller.admin.message.vo.message.MpMessagePageReqVO;
import com.zmm.zebulon.module.mp.dal.dataobject.message.MpMessageDO;
import com.zmm.zebulon.starter.mybatis.mybatis.core.mapper.BaseMapperX;
import com.zmm.zebulon.starter.mybatis.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * description: TODO
 *
 * @author zebulon
 * package com.zmm.zebulon.module.mp.dal.mysql.message
 * name: MpMessageMapper
 * date 2024/1/11 21:51
 */
@Mapper
public interface MpMessageMapper extends BaseMapperX<MpMessageDO> {

    default PageResult<MpMessageDO> selectPage(MpMessagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MpMessageDO>()
                .eqIfPresent(MpMessageDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(MpMessageDO::getType, reqVO.getType())
                .eqIfPresent(MpMessageDO::getOpenid, reqVO.getOpenid())
                .betweenIfPresent(MpMessageDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MpMessageDO::getId));
    }

}
